﻿{include file="common/header" /}
<!-- 中间区域 -->
<link rel="stylesheet" href="/home/css/product.css">

<script src="/home/js/jquary.js"></script>

<!-- 背景图 -->
<div class="banner-bg-wrap" style="background-image: url({$catTreeList.topCate.logo})"></div>

<!-- 内容 -->
<div class="content-wrap">
    <div class="wrap-box">
        <div class="tag-wrap wrap-start">
            <svg t="1654208066747" class="icon" viewBox="0 0 1024 1024" version="1.1"
                 xmlns="http://www.w3.org/2000/svg" p-id="998" width="200" height="200">
                <path
                        d="M731.546 588.952C782.032 501.857 806 432.632 806 384c0-162.372-131.628-294-294-294S218 221.628 218 384c0 48.633 23.968 117.857 74.454 204.952C341.914 674.28 415.131 773.963 512 887.432c96.869-113.469 170.085-213.153 219.546-298.48zM549.64 981.52a50 50 0 0 1-4.727 4.727c-20.788 18.177-52.375 16.06-70.553-4.727C243.453 717.45 128 518.277 128 384 128 171.923 299.923 0 512 0s384 171.923 384 384c0 134.277-115.453 333.45-346.36 597.519zM512 544c88.366 0 160-71.634 160-160s-71.634-160-160-160-160 71.634-160 160 71.634 160 160 160z m0-90c-38.66 0-70-31.34-70-70s31.34-70 70-70 70 31.34 70 70-31.34 70-70 70z"
                        p-id="999" fill="#666666"></path>
            </svg>
            <span>首页 >&nbsp;<a>{$catTreeList.topCate.title} </a></span>
            <span class="tag-text">>&nbsp;{$catInfo.title}</span>
        </div>
        <h4 class="title-wrap1 mt50">{$catInfo.title}</h4>
        <div class="mu_one">
            <form>
                {foreach name="filterList" item="field"}
                <?php $filedName = $field['field_name'];?>
                <div class="mu_bi">
                    <p>{$field.field_other_name}</p>
                    <select name="{$field.field_name}" class="getSelect">
                        <option value="0"  {if isset($$filedName)&& $$filedName == "0"}selected{/if}>全部</option>
                        {foreach name="field.filter" item="flt"}
                        <option value="{$flt.value}" {if isset($$filedName)&& $$filedName == $flt.value}selected{/if}>{$flt.name}</option>
                        {/foreach}
                    </select>
                </div>
                {/foreach}

            </form>
        </div>
        <ul class="xin_all">
            {foreach name="articleList" item="atc"}
            <li>
                <a href="site-{$linkName}/show-{$atc.cat_id}-{$atc.id}.html">
                    <img src="{$atc.logo}">
                    <h4>{$atc.title}</h4>
                    <h5>{$atc.subtitle|raw|nl2br}</h5>
                </a>
                <h6>
                    <p><?=date("Y-m-d",strtotime($atc['create_at']))?></p>
                    <span>浏览：{$atc.read_count}</span>
                </h6>
            </li>
            {/foreach}
        </ul>
        {$page|raw}

    </div>
</div>
<script>
    $(".getSelect").change(function (){
        var id = {$catId};
        var name = $(this).attr("name")
        var value = $(this).val()
        var oldUrl = location.href;
        var url = "/index/article/list/id/"+id + "?filter=1";

        if(!getUrlParams('filter')){
            oldUrl = oldUrl + "?filter=1";
        }

        if(getUrlParams(name)) {
            url = UpdateUrlPriceParam(name, value);
        }else{

            url = oldUrl + "&"+name+"="+value;


        }

        window.location.href = url;

    });


    function getUrlParams(key) {
        var url = window.location.search.substr(1);
        if (url == '') {
            return false;
        }
        var paramsArr = url.split('&');
        for (var i = 0; i < paramsArr.length; i++) {
            var combina = paramsArr[i].split("=");
            if (combina[0] == key) {
                return combina[1];
            }
        }
        return false;
    }


    function UpdateUrlPriceParam(name, val) {
        var thisURL = document.location.href;
        // 如果 url中包含这个参数 则修改
        if (thisURL.indexOf(name+'=') > 0) {
            var v = getUrlParams(name);
            if (v != null) {
                // 是否包含参数
                thisURL = thisURL.replace(name + '=' + v, name + '=' + val);
            }
        }
        return thisURL;
    }
</script>

<!-- 中间区域结束 -->
{include file="common/footer" /}